# select 
snippet select 
	SELECT ${1} FROM ${2} ${3:WHERE} ${4};
snippet selectd
	SELECT DISTINCT ${1} FROM ${2} ${3:WHERE} ${4};
snippet jn 
	JOIN ${1} ON ${2}
snippet lj 
	LEFT JOIN ${1} ON ${2}
snippet rj 
	RIGHT JOIN ${1} ON ${2}
snippet gb 
	GROUP BY ${1}
snippet ob 
	ORDER BY ${1} ${2:DESC}
snippet lim
	LIMIT ${1:start}${2:,end}
snippet cat
	CONCAT( ${1}, ${2} )
snippet conv # Convert from one base to another
	CONV( ${1:value}, ${2:from_base}, ${3:to_base} )
snippet set
	SET @${1:varname} = ${2:value};
snippet decl 
	DECLARE ${1:varname} ${2:type};
snippet if
	IF ${1} THEN
		${2}
	END IF;
snippet ife
	IF ${1} THEN
		${2}
	ELSE
		${3}
	END IF;
snippet begin
	BEGIN
	END;
snippet prep
	PREPARE ${1:stmt_name} FROM ${2:txt};
snippet exe
	EXECUTE ${1:stmt_name} USING ${2:vars};
snippet dal
	DEALLOCATE PREPARE ${1:stmt_name};
snippet proc 
	DROP PROCEDURE IF EXISTS $1;
	delimiter $
	CREATE PROCEDURE ${1:procedure_name}( ${2:args} )
	${3:characteristic}
	${4:thisproc}:BEGIN
		${5:-- code}
	END;
	$
	delimiter ;
snippet fun 
	DROP FUNCTION IF EXISTS $1;
	delimiter $
	CREATE FUNCTION ${1:procedure_name}( ${2:args} )
	RETURNS ${3:type}
	${4:characteristic}
		${5:-- code}
	$
	delimiter ;
snippet repeat
	REPEAT
		${1}
	${2:UNTIL done} END REPEAT;
snippet fetch
	FETCH ${1:cursorname} INTO ${2:vars}
snippet while
	WHILE ${1} DO
		${2:statement_list}
	END WHILE;
